package com.heima.admin.controller.v1;

import com.heima.apis.admin.IAdminAuthNewsClient;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.dtos.NewsAuthDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RequestMapping("/api/v1/news")
@RestController
public class NewsAuthController {

    @Autowired
    private IAdminAuthNewsClient iAdminAuthNewsClient;

    /**
     * 获取所有文章列表
     * @param newsAuthDto
     * @return
     */
    @PostMapping("/list_vo")
    public ResponseResult listVo(@RequestBody NewsAuthDto newsAuthDto){
        return iAdminAuthNewsClient.listVo(newsAuthDto);
    }

    /**
     * 获取文章详情
     * @param wmNewsId
     * @return
     */
    @GetMapping("/one_vo/{id}")
    public ResponseResult onrVo(@PathVariable("id") Integer wmNewsId){
        return iAdminAuthNewsClient.onrVo(wmNewsId);
    }

    /**
     * 审核文章 不通过
     * @param newsAuthDto
     * @return
     */
    @PostMapping("/auth_fail")
    public ResponseResult authFail(@RequestBody NewsAuthDto newsAuthDto){
        return iAdminAuthNewsClient.authFail(newsAuthDto);
    }

    /**
     * 审核文章 通过
     * @param newsAuthDto
     * @return
     */
    @PostMapping("/auth_pass")
    public ResponseResult authPass(@RequestBody NewsAuthDto newsAuthDto){
        return iAdminAuthNewsClient.authPass(newsAuthDto);
    }
}
